package com.huawei.appgallery.forum.posts.card;

import android.app.Activity;
import android.content.Context;
import android.text.format.DateUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import o.azb;
import o.bzd.b;
import o.bzd.j;
import o.cgz;
import o.chy;
import o.ContentManager;
import o.eqx;
import o.evx;

public class ForumCampaignCard extends ForumCard {
    protected TextView ˊ;
    protected TextView ˋ;
    protected ImageView ˎ;
    protected TextView ˏ;

    public ForumCampaignCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        if (this.ʼॱ instanceof Activity) {
            azb.ॱ(view, b.ॱˑ);
        }
        this.ˋ = (TextView) view.findViewById(b.ͺ);
        this.ˏ = (TextView) view.findViewById(b.ʻ);
        this.ˊ = (TextView) view.findViewById(b.ॱㆍ);
        this.ˎ = (ImageView) view.findViewById(b.ᐨ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumCampaignCardBean) {
            ForumCampaignCardBean forumCampaignCardBean = (ForumCampaignCardBean) cardBean;
            this.ˋ.setText(forumCampaignCardBean.ˊ());
            this.ˏ.setText(forumCampaignCardBean.ˏॱ());
            this.ˋ.setAlpha(1.0f);
            this.ˏ.setAlpha(1.0f);
            this.ˊ.setAlpha(1.0f);
            ˎ(forumCampaignCardBean);
            ˏ(forumCampaignCardBean);
        }
    }

    protected void ˎ(ForumCampaignCardBean forumCampaignCardBean) {
        eqx.ˏ(this.ˎ, forumCampaignCardBean.ॱˌ(), "image_default_icon");
    }

    protected void ˏ(ForumCampaignCardBean forumCampaignCardBean) {
        long ʽ = forumCampaignCardBean.ʽ();
        long ᐝ = forumCampaignCardBean.ᐝ();
        long ʼ = forumCampaignCardBean.ʼ();
        String ˋ;
        if (ʼ < ʽ) {
            ˋ = ˋ(ʽ);
            this.ˊ.setText(ContentManager.getInstant().getContext().getResources().getString(j.ˊॱ, new Object[]{ˋ}));
        } else if (ʼ < ᐝ) {
            ˋ = ˋ(ᐝ);
            this.ˊ.setText(ContentManager.getInstant().getContext().getResources().getString(j.ॱˊ, new Object[]{ˋ}));
        } else {
            this.ˊ.setText(ContentManager.getInstant().getContext().getResources().getString(j.ͺ));
            this.ˋ.setAlpha(0.3f);
            this.ˏ.setAlpha(0.3f);
            this.ˊ.setAlpha(0.3f);
        }
    }

    public void ॱ(final chy o_chy) {
        View ˉ = ˉ();
        if (ˉ != null) {
            OnClickListener anonymousClass1 = new evx(this) {
                final /* synthetic */ ForumCampaignCard ˋ;

                public void ˋ(View view) {
                    if (o_chy != null) {
                        o_chy.ˏ(0, this.ˋ);
                    }
                }
            };
            ˉ.setOnClickListener(anonymousClass1);
            this.ˎ.setOnClickListener(anonymousClass1);
        }
    }

    private String ˋ(long j) {
        return DateUtils.formatDateTime(this.ʼॱ, j, 131092);
    }
}
